<template>
	<view class="bg">
		<view class="tx">
			<image src="../../static/tx.png" mode=""></image>
		</view>
		<view class="title">
			<image src="@/static/xiugai.png" mode=""></image>
		</view>
		<view class="put" style="margin-top: 82rpx;">
			<u--input placeholder="请输入新密码" type="password" placeholderStyle="color: #F5C7A6" fontSize="30" color="#fff"
				shape="circle" border="surround" v-model="form.password"></u--input>
		</view>
		<view class="put" style="margin-bottom: 205rpx;">
			<u--input placeholder="请再次输入密码" type="password" placeholderStyle="color: #F5C7A6" fontSize="30" color="#fff"
				shape="circle" border="surround" v-model="form.re_password"></u--input>
		</view>

		<view class="btn juedui">
			<u-button text="确认修改" shape="circle" @click="xiugai"
				color="linear-gradient(to right, rgb(254, 199, 130), rgb(239, 224, 201))"></u-button>
		</view>
	</view>
</template>

<script>
	import {
		resetPwd
	} from '@/api/url.js'
	export default {
		data() {
			return {
				form: {
					password: '',
					re_password: ''
				}
			}
		},
		onLoad(option) {

		},

		methods: {
			xiugai() {
				var token = uni.getStorageSync('token')
				resetPwd(this.form,token).then(res => {
					console.log(res)
					if (res.data.status == 200) {
						uni.showToast({
							title: res.data.msg,
							icon: 'none',
							duration: 2000
						})
						uni.redirectTo({
							url: '/pages/index/index'
						})
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none',
							duration: 2000
						})
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #30324C;
	}

	.bg {
		width: 100%;

		.tx {
			text-align: center;
			padding: 122rpx 0 60rpx 0;
			box-sizing: border-box;

			image {
				width: 152rpx;
				height: 152rpx;
			}
		}

		.put {
			width: 90%;
			margin: 0 auto;
		}

		.xieyi {
			width: 90%;
			margin: 0 auto;
			margin-top: 49rpx;
			margin-bottom: 80rpx;
			display: flex;
			color: #858BA3;
			font-size: 30rpx;

			.yonghu {
				color: #F5C7A6;
				text-decoration: underline;
			}
		}

		.title {
			width: 80%;
			margin: 0 auto;
			height: 40rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.wangji {
			display: flex;
			align-items: center;
			justify-content: flex-end;
			width: 90%;
			margin: 0 auto;
			color: #F5C7A6;
			font-size: 30rpx;
			margin-top: 32rpx;

			image {
				width: 36rpx;
				height: 36rpx;
				margin-right: 16rpx;
			}
		}
	}

	input {
		border: 2rpx solid #F5C7A6;
		border-radius: 50rpx;
		padding: 14rpx 48rpx;
	}
</style>